/* -*- c++ -*- */
/* role.h */
/* author: jiqing */
/* create: 2012-01-04 */
/* update: 2014-05-01 Thu */

#ifndef _ROLE_H_
#define _ROLE_H_

#include "TextParser.h"
#include "Nick.h"

#define MAX_GOODS_NUM	9
#define MAX_SKILL_LEVEL	 10		//每项技能最高十级
#define MAX_SKILL_NUM  9

class CRole
{
public:
	struct SkillHaved {
		short nSkillIndex;
		short nSkillLevel;
		short nTimes;	//使用次数
	};	

    short nID;

	char szName[32];
	char szDetail[256];
    char szNick[32];

    short nExps[SKILL_KIND];
	short nHP;
	short nMaxHP;
	short nMP;
	short nMaxMP;	
	short nAttack;
	short nDefend;
	short nSpeed;	
	
	short nSkillNum;						//拥有的技能数量
	SkillHaved MySkills[ MAX_SKILL_NUM ];	//最多拥有9种技能
	short nGoodsNum;						//带的物品数
	short MyGoods[ MAX_GOODS_NUM ];			//最多带9个物品

	short MyEquipment[4];	//0-head, 1-body, 2-hand, 3-foot
	short nMoney;			//钱

	short nTalkScript;		//当与该人物对话时触发的脚本
	short nFailScript;		//当人物被打败时触发的脚本，-1表示没有

public:	
    void ShowName();
    void ShowNickName();
    void ShowDetail();
    void ShowDetailX(CNickData &);
    void ShowState();
    void UpdateNick(CNickData &);
    bool Load(CTextParser &file);

    short GetAddedAttack();
    short GetAddedDefend();
    short GetAddedSpeed();

    void AddMoney(short n);
    void DelMoney(short n);

    short GetItem(short i);
    short HaveItem(short i);

    void Refresh();
};


#endif
